<template>
  <div>
    <div class="mui-numbox"  data-numbox-min='1'>
					<button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
					<input class="mui-input-numbox" type="number" value="1" @change="sendCount" ref="input"/>
					<button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
		</div>
  </div>
</template>
<script>
import mui from '../../lib/mui/js/mui.min.js'
export default {
  props:['max'],
  mounted() {
    mui('.mui-numbox').numbox()
  },
  methods: {
    sendCount(){
      this.$emit('getSelectedCount',this.$refs.input.value)
    }
  },
  watch:{
    max:{
      handler(newVal,oldVal){
      mui('.mui-numbox').numbox().setOption('max',newVal)
      },
    }
  }
}
</script>
<style lang="scss" scoped>
  
</style>